﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SP.OpenSource.CDC.Monitor
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                //Check for arguments, if any then it is called for scheduler.
                if (args.Length > 0)
                {
                    String sArgsScheduler = args[0];
                    String sArgsMonitor = args[1];

                    BLL.Scheduler oScheduler = new BLL.Scheduler();
                    oScheduler.MonitorCDC(sArgsMonitor);
                }
                else
                {
                    Application.Run(new frmConnect());
                }
            }
            catch (Exception ex)
            {
                try
                {
                    System.Diagnostics.EventLog appLog = new System.Diagnostics.EventLog();
                    appLog.Source = "MonitorCDC";
                    appLog.WriteEntry("Exception raised, while processing request." +Environment.NewLine + " Message: " + ex.Message);
                }
                catch
                {
                }
            }
        }
    }
}
